
package de.carcophan.jimdb.jsf.mb;

import de.carcophan.jimdb.ejb.entites.User;
import de.carcophan.jimdb.jsf.security.AuthenticatedUser;
import java.io.Serializable;
import javax.faces.context.FacesContext;
import javax.inject.Inject;



public abstract class AbstractController implements Serializable {

    @Inject
    AuthenticatedUser authenticatedUser;

    public FacesContext getFacesContext() {
        return FacesContext.getCurrentInstance();
    }

    public User getAuthenticatedUser() {
        return authenticatedUser.getUser();
    }

    public Boolean isUserInRole(String role){
        return getFacesContext().getExternalContext().isUserInRole(role);
    }


}
